package com.sk.bilibili.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.sk.bilibili.apiMapper.ApiMapper;
import com.sk.bilibili.property.BiliBiliProperty;
import org.jasypt.util.password.BasicPasswordEncryptor;
import org.jasypt.util.password.PasswordEncryptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

/**
 * @author 邵康
 * @date 2021/11/16 12:04
 * 任何无法 归纳的配置都在这
 */
@Configuration
public class BiliBiliConfig {

    @Autowired
    private BiliBiliProperty biliBiliProperty;

    @Bean
    public PasswordEncryptor passwordEncryptor(){
        return new BasicPasswordEncryptor();
    }

    @Bean// 注入  api映射
    public ApiMapper apiMapper(){
        ApiMapper apiMapper = new ApiMapper();
        apiMapper.init();
        apiMapper.setLogInfo(biliBiliProperty.isApiLog());
        return apiMapper;
    }

    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        return new ServerEndpointExporter();
    }

}
